/**
 * 
 */
package kr.pe.johnkim.partytalk.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * @author johnkim
 *
 */
public class PartyTalkCommon {
	
	public static String TAG = PartyTalkCommon.class.getSimpleName();

	/**
     * Base URL of the Demo Server (such as http://my_host:8080/gcm-demo)
     */
    public static final String SERVER_URL = null;

    /**
     * Google API project id registered to use GCM.
     */
	public static final String SENDER_ID = "944691534021";
	
	/**
     * Intent used to display a message in the screen.
     */
    public static final String DISPLAY_MESSAGE_ACTION =
            "com.google.android.gcm.demo.app.DISPLAY_MESSAGE";

    /**
     * Intent's extra that contains the message to be displayed.
     */
    public static final String EXTRA_MESSAGE = "message";

    /**
     * Notifies UI to display a message.
     * <p>
     * This method is defined in the common helper because it's used both by
     * the UI and the background service.
     *
     * @param context application's context.
     * @param message message to be displayed.
     */
    public static void displayMessage(Context context, String message) {
        Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
        intent.putExtra(EXTRA_MESSAGE, message);
        context.sendBroadcast(intent);
    }
    
	/**
	 * 현재 날짜와 시간을 2010-10-22 15:20:46 포멧의 string 으로 반환한다.
	 * 
	 * @return
	 */
	public String getCurrentDate() {
		Log.i(TAG, "getCurrentDate");
		
		String currentDate = "";

		Date date = new Date();
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		currentDate = simpleDateFormat.format(date);

		return currentDate;
	}
}
